﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace NFinalCompiler.SqlModel
{
    public class EnumModelData
    {
        public string NameSpace { get; set; }
        public SystemEnumInfo SystemEnumInfo { get; set; }

        public List<KeyValuePair<int, string>> GetEnumList()
        {
            string[] keyValueArray= SystemEnumInfo.Definition.Split(',');
            List<KeyValuePair<int, string>> list = new List<KeyValuePair<int, string>>();
            int key = 0;
            string value = null;
            foreach (var keyValue in keyValueArray)
            {
                string[] leftRight = keyValue.Split('=');
                int.TryParse(leftRight[1].Trim(),out key);
                value = leftRight[0].Trim();
                list.Add(new KeyValuePair<int, string>(key, value));
            }
            return list;
        }
    }
}
